const t = Date.now()
while (Date.now() - t < 1000) {
  console.log('main');
}
const div = document.querySelector('div');
div.style.background = Math.random() > 0.5 ? 'red' : 'green';